import request from '../utils/request';
import { PAGE_SIZE } from '../constants';

export function findAllByPage({ page, queryStr }) {
  return request(`/myDemo/all?_page=${page}&_limit=${PAGE_SIZE}&query=${queryStr}`);
}

export function insertUser(values) {
  return request('/myDemo/insert', {
    headers: {
      'Content-Type': 'application/json',
    },
    method: 'POST',
    body: JSON.stringify(values),
  });
}

export function updateUser(values) {
  return request('/myDemo/update', {
    headers: {
      'Content-Type': 'application/json',
    },
    method: 'POST',
    body: JSON.stringify(values),
  });
}

export function deleteUser(id) {
  return request(`/myDemo/delete/${id}`, {
    method: 'DELETE',
  });
}
